<?php
class picture extends Model{
	
	/**
	 * 添加图片
	 * @param unknown_type $pictype
	 * @param unknown_type $piclink
	 */
	public function addPic($pictype,$piclink)
	{
		$sql = "INSERT INTO `howdo`.`picture` (`pic_id`, `pic_type`, `pic_link`, `pic_state`) VALUES (NULL, '".$pictype."', '".$piclink."', '0');";
// 		echo $sql;
		return $this->insert($sql);
	}
	/**
	 * 删除图片
	 * @param unknown_type $pid
	 * @return resource
	 */
	public function delpic($pid)
	{
		$sql = "DELETE FROM `howdo`.`picture` WHERE `picture`.`pic_id` = '".$pid."'";
		//echo $sql;
		return $this->del($sql);
	}
	
	/**
	 * 图片设置启用
	 * @param unknown_type $pid
	 * @return resource
	 */
	public function setPictureState($pid){
		$sql = "UPDATE `howdo`.`picture` SET `pic_state` = '1' WHERE `picture`.`pic_id` = '".$pid."';";
		//echo $sql;
		return $this->update($sql);
	}
}